package com.voicechat.firstmet.view;

import android.content.Context;
import android.support.v7.widget.LinearLayoutManager;

/**
 * @ProjectName: FirstMet
 * @Package: com.voicechat.firstmet.view
 * @ClassName: CustomLinearLayoutManager
 * @Description: java类作用描述
 * @Author: ljp
 * @CreateDate: 2018/9/10 19:50
 * @Version: 1.0
 */
public class CustomLinearLayoutManager extends LinearLayoutManager {
    private boolean isScrollEnabled = true;

    public CustomLinearLayoutManager(Context context) {
        super(context);
    }

    public CustomLinearLayoutManager(Context context, int orientation, boolean reverseLayout, boolean isScrollEnabled) {
        super(context, orientation, reverseLayout);
        this.isScrollEnabled = isScrollEnabled;
    }

    /**
     * 水平滚动
     * @return
     */
    @Override
    public boolean canScrollHorizontally() {
        return isScrollEnabled && super.canScrollVertically();
    }
    /**
     * 垂直滚动
     * @return
     */
    @Override
    public boolean canScrollVertically() {
        //Similarly you can customize "canScrollHorizontally()" for managing horizontal scroll
        return isScrollEnabled && super.canScrollVertically();
    }
}
